using SharpPlanetsModel;
namespace GameModel {
  public class TurnPlayer1: ITurnPlayer {
    private static TurnPlayer1 instance;
    private int _Angle;
    private int _Speed;

    /// <summary>
    /// costruttore
    /// </summary>
    private TurnPlayer1() {
      _Angle = Configuration.startAngleLeftValue;
      _Speed = Configuration.startSpeedValue;
    }

    // <summary>
    /// propriet� pubblica che esporta l'unica istanza della classe
    /// </summary>
    public static TurnPlayer1 Instance {
      get {
        if (instance == null) {
          instance = new TurnPlayer1();
        }
        return instance;
      }
    }

    public int Speed {
      get {
        return _Speed;
      }
      set {
        if (value > Configuration.maxSpeedAcceptedValue)
          value = Configuration.maxSpeedAcceptedValue;
        else if (value < Configuration.minSpeedAcceptedValue)
          value = Configuration.minSpeedAcceptedValue;
        _Speed = value;
      }
    }

    public int Angle {
      get {
        return _Angle;
      }
      set {
        while (value > Configuration.maxAngleAcceptedValue)
          value = value - Configuration.maxAngleAcceptedValue;

        while (value < 0)
          value = value + Configuration.maxAngleAcceptedValue;

        _Angle = value;
      }
    }

    public string StatusText {
      get {
        return Configuration.playerOneLabel;
      }

    }

    public void Shoot() {
      throw new System.NotImplementedException();
    }
  }
}
